<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改售后预约')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-customer-edit" th:object="${jtCustomerService}">
            <input name="serviceId" th:field="*{serviceId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{bookPhone}]]：</label>
                    <div class="col-sm-8">
                        <input name="countryCode" th:field="*{countryCode}" class="input-line" type="number" maxlength="5" style="width: 70px;" placeholder="国家码">
                        <span>-</span>
                        <input name="phoneNumber" th:field="*{phoneNumber}" class="input-line" type="number" maxlength="11" style="width: 120px;" placeholder="电话" >
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{email}]]：</label>
                    <div class="col-sm-8">
                        <input th:value="*{email}" class="form-control" type="text" readonly="readonly">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{address}]]：</label>
                    <div class="col-sm-8">
                        <input th:field="*{fullAddress}" class="form-control" type="text" readonly="readonly">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{bookRepairTime}]]：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input th:value="${#dates.format(jtCustomerService.repairTime, 'yyyy-MM-dd')}" class="form-control" type="text" readonly="readonly">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{deviceModelNo}]]：</label>
                    <div class="col-sm-8">
                        <input th:field="*{deviceModelNo}" class="form-control" type="text" readonly="readonly">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{faultProblem}]]：</label>
                    <div class="col-sm-8">
                        <textarea class="form-control" th:rows="5" readonly="readonly">[[*{problem}]]</textarea>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{picture}]]1：</label>
                    <div class="col-sm-8">
                        <img th:src="*{imageUrl1}" width="300px" />
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{picture}]]2：</label>
                    <div class="col-sm-8">
                        <img th:src="*{imageUrl2}" width="300px" />
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">[[#{processingStatus}]]：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('jt_processing_status')}">
                            <input type="radio" th:id="${'repairStatus_' + dict.dictCode}" name="repairStatus" th:value="${dict.dictValue}" th:field="*{repairStatus}">
                            <label th:for="${'repairStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">[[#{maintenanceStaff}]]：</label>
                    <div class="col-sm-8">
                        <select name="repairUserId" th:field="*{repairUserId}" class="form-control" required>
                            <option value="">-请选择-</option>
                            <option th:each="item: ${repairList}" th:value="${item.userId}" th:text="${item.userName}" th:phoneNumber="${item.phonenumber}" ></option>
                        </select>
                        <input name="repairBy" th:field="*{repairBy}" class="form-control" type="hidden">
                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请将维修人员，权限设置为：repairer。</span>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">[[#{contactNumber}]]：</label>
                    <div class="col-sm-8">
                        <input name="repairPhoneNumber" th:field="*{repairPhoneNumber}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "business/customer";
        $("#form-customer-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-customer-edit').serialize());
            }
        }


        $("#repairUserId").bind("change", function() {
            var repair = $(this).find("option:selected").text();
            var phoneNumber = $(this).find("option:selected").attr("phoneNumber");
            console.log(repair);
            console.log("==="+phoneNumber);
            $("input[name='repairBy']").val(repair);
            $("input[name='repairPhoneNumber']").val(phoneNumber);
        });
    </script>
</body>
</html>